package com.twu.biblioteca;

import java.util.Arrays;

/**
 * Created by abhishekpuri on 10/7/14.
 */
public class User {

    private String _Name;
    private String _EMail;
    private String _PhoneNumber;
    private char[] _Password;
    private short _AuthorityLevel;
    private String _LibraryID;

    public User(String name,String eMail,String phoneNumber,char[] password,String libraryID) {      //Constructor for production
        _Name = name;
        _EMail= eMail;
        _PhoneNumber = phoneNumber;
        _Password = password;
        _AuthorityLevel = 0;
        _LibraryID=libraryID;
    }

    public User(String name,String eMail,String phoneNumber,char[] password,String libraryID, short authority) {
        _Name = name;
        _EMail= eMail;
        _PhoneNumber = phoneNumber;
        _Password = password;
        _AuthorityLevel = authority;
        _LibraryID=libraryID;
    }

    public String getUserSummary() {
        return _Name + "(" + _EMail + ")\t" + _PhoneNumber;
    }

    public boolean authenticateUser(char[] password) {
        return Arrays.equals(_Password,password);
    }

    public short getAuthorityLevel() {
        return _AuthorityLevel;
    }

    public String getLibraryID() {return _LibraryID; }
}
